Skip to content

feat(cli): add ado-aw status#596

Closed
jamesadevine wants to merge 3 commits into
feat/cli-listfrom
feat/cli-status
Closed

feat(cli): add ado-aw status#596
jamesadevine wants to merge 3 commits into
feat/cli-listfrom
feat/cli-status

Conversation

@jamesadevine
Copy link
Copy Markdown
Collaborator

Summary

Implements PR 7 of the Phase 1 CLI overhaul. Adds ado-aw status [PATH] — denser per-pipeline status block (name, id, folder, queueStatus, latest-run summary, deep link) for every matched ADO definition. Read-only.

Depends on #594 (ado-aw list) for the shared crate::list::{ListRow, LastRun, build_rows, render_json} data path and the get_latest_build ado/mod.rs helper. Branched off feat/cli-list; rebase onto main after #594 merges.

CLI surface

ado-aw status [PATH]
  --org <url-or-name>          # default: from git remote
  --project <name>             # default: from git remote
  --pat <pat>                  # else AZURE_DEVOPS_EXT_PAT, else az CLI
  --json                       # same shape as `list --json`

Output (default)

● Daily safe-output smoke: noop
  id:           123
  folder:       \smoke
  queueStatus:  enabled
  source:       tests/safe-outputs/noop.lock.yml
  last run:     build 4567 — succeeded @ 2026-05-17T08:00:00Z
  url:          https://dev.azure.com/.../4567

Plumbing

  • The block renderer is a pure function (render_blocks) with 6 unit tests covering empty input, succeeded runs, runs without URLs (synthesizes from org/project/buildId), absent last runs, in-progress runs (uses status when result is missing), and missing queueStatus.
  • --json delegates to crate::list::render_json so the JSON shape never drifts from list --json.
  • Uses crate::list::build_rows with include_unmatched: false--all is intentionally absent because the per-pipeline block format is only useful for matched definitions.

Verified

  • cargo build
  • cargo clippy --all-targets --all-features
  • cargo test ✅ — 6 new unit tests in status.rs, 2 integration tests in tests/status_integration.rs.

Out of scope

PR 8 (secrets), PR 9 (help-text grouping), PR 10 (doc overhaul).

Implements PR 7 of the Phase 1 CLI overhaul. Renders per-pipeline
status — name, id, folder, queueStatus, latest-run summary, and a
deep link — one block per matched ADO definition. Read-only.

`status` is intentionally a thin renderer over the same data path as
`list` (same `list_definitions` + `match_definitions` +
`get_latest_build` sequence). The `--json` shape is byte-for-byte
identical to `list --json` so scripts can use either.

CLI surface:

    ado-aw status [PATH] --org --project --pat --json

The block renderer is a pure function (`render_blocks`) tested
against six scenarios:

- empty → placeholder line
- succeeded run with url → all fields rendered
- run with no url → synthesizes
  `{org_url}/{project}/_build/results?buildId={id}`
- no last run → "never" + no url line
- in-progress run (no `result` yet) → shows `status` value instead
- missing queueStatus → renders `?` placeholder

Depends on PR 5 (#594) for `crate::list::{ListRow, LastRun,
build_rows, render_json}`; reuses the `get_latest_build` ado/mod.rs
helper landed there.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Rust PR Review

Summary: Looks good overall — clean implementation, solid test coverage, well-scoped design. One redundant API call worth fixing.

Findings

🐛 Bugs / Logic Issues

  • src/status.rs:103–107list_definitions called twice per invocation.
    status::run calls list_definitions explicitly on line 103, then calls match_definitions on line 105. But match_definitions in src/ado/mod.rs:379 unconditionally calls list_definitions itself. That's two identical GET requests to the ADO definitions endpoint for every ado-aw status invocation.

    The same issue exists in list::run (introduced in the base branch feat(cli): add ado-aw list #594), so this PR inherits the bug. The fix is to refactor match_definitions to accept a pre-fetched &[DefinitionSummary] slice instead of fetching internally, or to drop the explicit list_definitions call in run and rely on match_definitions + pass definitions into build_rows separately. Worth fixing in one place so both commands benefit.

⚠️ Suggestions

  • src/status.rs:105–107 — silent swallow of match_definitions error.
    .unwrap_or_default() on the match_definitions result means auth failures (401/403) or network errors will silently produce (no matched definitions) rather than surfacing an error. This matches list::run's behavior so it's consistent, but it can be confusing to users. At minimum, a warning to stderr would help. Low priority since it's shared behavior.

  • src/status.rs:17–19AdoAuth and AdoContext are imported but never referenced by name.
    let auth = resolve_auth(...) and let ado_ctx = resolve_ado_context(...) rely on type inference; the type names themselves aren't used. If clippy doesn't flag these now it will when the edition lint is tightened. Minor, but easy to clean up.

✅ What Looks Good

  • Pure render_blocks function with 6 targeted unit tests is a solid design — easy to test in isolation without touching the ADO API.
  • URL synthesis fallback (lr.url.clone().unwrap_or_else(|| format!(...))) is a useful resilience pattern and the test for it is correct.
  • include_unmatched: false for build_rows is the right call — the dense block format only makes sense for matched definitions.
  • --json delegation to render_json from list is correct: the JSON shape will never drift between the two commands.
  • Integration tests for --help content are a lightweight but effective way to guard the CLI surface area.

Generated by Rust PR Reviewer for issue #596 · ● 424.8K ·

@jamesadevine
Copy link
Copy Markdown
Collaborator Author

@copilot address feedback and suggestions

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

@copilot address feedback and suggestions

Addressed in 250d7b3.

I fixed the review feedback by removing duplicate ADO definitions fetches in both list and status (shared matcher now works from pre-fetched definitions), and cleaned up the now-unused imports in these command modules.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/githubnext/ado-aw/issues
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-5cd66b4699336750 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-5cd66b4699336750 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.1h/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.12i29wz1dhp34bciudlqzb4dc.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.1p/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.15btcon2i8x89vm7dv3o62k1e.0flzzyx.rcgu.o 64-REDACTED-linux-gnu/bin/gcc-ld/ld.lld /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.2l/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.18tadnkxqth74oqw29u3739pc.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.2m/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1995jcy810mpmhr6ufju2avvl.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.30/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1hbbgx7p97opci5mvqje7wetx.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.31/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1l6g83cfrj6b4x40nq0qad8b2.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.42/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1rrcezsyga3qzrcuqerezuvgl.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4934yc�� /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4sdmiar95uab0g9sh7pkk3spi.1hc5rch.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4yo6asuqvic1apurk0bpj38qb.1hc5rch.rcgu.o 7gqa�� ug1mnuvuwh5co9ze4dk.04h1n6z.rcgu.o 4yhrz5hh8u0k8t7proz.04h1n6z.rcgu.o f/dirs-sys-0.5.0-m lib/rustlib/x86_cc lib/rustlib/x86_-m64 lib/rustlib/x86_/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/rustcpTjro6/symbols.o lib/rustlib/x86_/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.04/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.0gcwkgqr8sb9mr7b2x8ns7d9o.0flzzyx.rcgu.o (http block)
  • spsprodeus21.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-5cd66b4699336750 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-5cd66b4699336750 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.1h/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.12i29wz1dhp34bciudlqzb4dc.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.1p/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.15btcon2i8x89vm7dv3o62k1e.0flzzyx.rcgu.o 64-REDACTED-linux-gnu/bin/gcc-ld/ld.lld /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.2l/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.18tadnkxqth74oqw29u3739pc.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.2m/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1995jcy810mpmhr6ufju2avvl.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.30/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1hbbgx7p97opci5mvqje7wetx.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.31/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1l6g83cfrj6b4x40nq0qad8b2.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.42/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1rrcezsyga3qzrcuqerezuvgl.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4934yc�� /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4sdmiar95uab0g9sh7pkk3spi.1hc5rch.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4yo6asuqvic1apurk0bpj38qb.1hc5rch.rcgu.o 7gqa�� ug1mnuvuwh5co9ze4dk.04h1n6z.rcgu.o 4yhrz5hh8u0k8t7proz.04h1n6z.rcgu.o f/dirs-sys-0.5.0-m lib/rustlib/x86_cc lib/rustlib/x86_-m64 lib/rustlib/x86_/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/rustcpTjro6/symbols.o lib/rustlib/x86_/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.04/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.0gcwkgqr8sb9mr7b2x8ns7d9o.0flzzyx.rcgu.o (dns block)
  • spsprodweu4.vssps.visualstudio.com
    • Triggering command: /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-5cd66b4699336750 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/ado_aw-5cd66b4699336750 /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.1h/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.12i29wz1dhp34bciudlqzb4dc.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.1p/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.15btcon2i8x89vm7dv3o62k1e.0flzzyx.rcgu.o 64-REDACTED-linux-gnu/bin/gcc-ld/ld.lld /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.2l/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.18tadnkxqth74oqw29u3739pc.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.2m/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1995jcy810mpmhr6ufju2avvl.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.30/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1hbbgx7p97opci5mvqje7wetx.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.31/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1l6g83cfrj6b4x40nq0qad8b2.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.42/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.1rrcezsyga3qzrcuqerezuvgl.0flzzyx.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4934yc�� /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4sdmiar95uab0g9sh7pkk3spi.1hc5rch.rcgu.o /home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.4yo6asuqvic1apurk0bpj38qb.1hc5rch.rcgu.o 7gqa�� ug1mnuvuwh5co9ze4dk.04h1n6z.rcgu.o 4yhrz5hh8u0k8t7proz.04h1n6z.rcgu.o f/dirs-sys-0.5.0-m lib/rustlib/x86_cc lib/rustlib/x86_-m64 lib/rustlib/x86_/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/rustcpTjro6/symbols.o lib/rustlib/x86_/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/init_tests-fe8c41cc83486af2.04/home/REDACTED/work/ado-aw/ado-aw/target/debug/deps/compiler_tests-edaff8d7190a2fae.0gcwkgqr8sb9mr7b2x8ns7d9o.0flzzyx.rcgu.o (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@jamesadevine
Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/4a073841-36db-4a76-8199-ee66398a346b

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in f0edafa.

I merged feat/cli-list into this branch, resolved the conflict in src/list.rs, kept the single-fetch matcher fix, and verified with targeted list/status tests.

@jamesadevine
Copy link
Copy Markdown
Collaborator Author

Superseded by #602 ( eat/cli-lifecycle-family), which consolidates all six in-flight Phase 1 lifecycle PRs into a single linear-history branch. Closing this PR; review feedback should land on #602.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants